//
//  ArleneTableViewDataSource.h
//  ArleneTableViewWrapper
//
//  Created by CambriaYang on 16/9/18.
//  Copyright © 2016年 yeio. All rights reserved.
//

#import "ArleneNode.h"

#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>

@class ArleneTableSection;
@class ArleneTableRow;

NS_ASSUME_NONNULL_BEGIN

@protocol ArleneTableViewDataSource <NSObject>

/**
 * A convenient utility method for retrieving the row at specified index path.
 *
 * @param indexPath An index path locating a row in data source.
 * @return The row at specified index path.
 */
- (__kindof ArleneTableRow *)rowAtIndexPath:(NSIndexPath *)indexPath;

- (nullable NSArray <__kindof ArleneNode *> *)allSections;



/**
 According the constraints set to the views, calculating the height for a cell
 *
 */
- (CGFloat)autoAdjustedCellHeightAtIndexPath:(NSIndexPath *)indexPath inTableView:(UITableView *)tableView;

@end

@interface ArleneTableViewDataSource : ArleneNode <UITableViewDataSource, ArleneTableViewDataSource>

/**
 * Inserts a given section at the end of the section array.
 *
 * @param section The section object to add to the end of section array. This value MUST NOT be nil.
 */
- (void)addSection:(__kindof ArleneTableSection *)section;
- (void)addSectionsFromArray:(NSArray <__kindof ArleneTableSection *> *)array;
- (void)registerClass:(nonnull Class)cellClass forCellReuseIdentifier:(NSString *)identifier;
- (void)invalidAutoCalculatedCellHeight;

@end

NS_ASSUME_NONNULL_END
